package edu.bbu.commonproject.desktop.client.services;

import java.util.ArrayList;

import edu.bbu.commonproject.desktop.client.exceptions.DataBaseErrorException;
import edu.bbu.commonproject.desktop.client.exceptions.DirectoryOperationException;
import edu.bbu.commonproject.desktop.client.exceptions.NoConnectionException;
import edu.bbu.commonproject.desktop.client.exceptions.WrongUserDataException;
import edu.bbu.commonproject.desktop.client.model.DirectoryPOJO;

/**
 * Interface that all directory service implamentation must suport.
 */
public interface DirectoryCLTServices 
{
	/** The directory separator. */
	public static String separator = "\\";
	
	/**
	 * Creating a new directory.
	 * @param directory the directory, it must contain the directory name, the owner and the parrent directory.
	 * @throws NoConnectionException if the connection dropped.
	 */
	public abstract void createDirectory(DirectoryPOJO directory) throws NoConnectionException, DirectoryOperationException, DataBaseErrorException;
	
	/**
	 * Deleting an existing directory.
	 * @param directory the directory, it must contain the directory name, the owner and the parrent directory.
	 * @throws NoConnectionException if the connection dropped.
	 */
	public abstract void deleteDirectory(DirectoryPOJO directory) throws NoConnectionException, DirectoryOperationException, DataBaseErrorException;
	
	/**
	 * Getting the directory content of a directory.
	 * @param directory the directory, it must contain the directory name, the owner and the parrent directory.
	 * @return the list of directories.
	 * @throws NoConnectionException if the connection dropped.
	 */
	public abstract ArrayList<String> getDirectoriesFromDirectory(DirectoryPOJO directory) throws NoConnectionException, DataBaseErrorException;
	
	/**
	 * Getting the base directory.
	 * @param owner the owner of the directory.
	 * @return the base directory.
	 * @throws NoConnectionException if the connection dropped.
	 */
	public abstract DirectoryPOJO getBaseDirectory(String owner) throws NoConnectionException;
	
	/**
	 * Setting the sync directory.
	 * @param directory the sync directory.
	 * @throws NoConnectionException if the connection dropped.
	 * @throws WrongUserDataException if the username not exist.
	 * @throws DataBaseErrorException if database error occured.
	 */
	public abstract void setSyncDirectory(DirectoryPOJO directory) throws NoConnectionException, DataBaseErrorException;
	
	/**
	 * Getting the sync directory.
	 * @param owner the owner of the directory.
	 * @return the base directory.
	 * @throws NoConnectionException if the connection dropped.
	 */
	public abstract DirectoryPOJO getSyncDirectory(String owner) throws NoConnectionException, WrongUserDataException, DataBaseErrorException;
	
}
